﻿<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>业务信息</title>
    <link rel="stylesheet" type="text/css" href="../Content/Css/OperaMasksUI/default/om-all.css" />
    <link rel="stylesheet" type="text/css" href="../Content/Css/list.css" />
    <script type="text/javascript" src="../Scripts/jquery.1.6.3.min.js"></script>
    <script type="text/javascript" src="../Scripts/json2.js"></script>
    <script type="text/javascript" src="../Scripts/common.js"></script>
    <script type="text/javascript" src="../Scripts/OperaMasksUI/operamasks-ui.min.js"></script>
    <script type="text/javascript" src="../Scripts/Plugin/jquery.form.js"></script>
    <script type="text/javascript" src="../Scripts/OperaMasksUI/Plugin/om-yj-container.js"></script>
    <script type="text/javascript" src="../Scripts/Plugin/artDialog4.1.7/jquery.artDialog.js?skin=default"></script>
    <script type="text/javascript" src="../Scripts/Plugin/artDialog4.1.7/plugins/iframeTools.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.easyui.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../Scripts/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../Scripts/themes/icon.css">
    <script type="text/javascript">
        var detailPanel, listGrid, colData, searchPanel, defaultSort, defaultWhere, validatorForm, submitForm, currentUID, currentGIndex = -1, genRenderCheckbox, genRenderDateformat;
        var showSearchPanel, showToolBar, showDetialForm, controlBtn, oldRowData, detailForm, goOn = true, DoFlag = true, ifh;
        var actionRoot = "../handler/ajax.ashx?type=AjaxSystem", comboxBankData = [], comboxTypeData = [], comboxStatusData = [], genRenderDateformat, genRenderDateformatSS;

        $(document).ready(function () {
            var element = $('body').omBorderLayout({
                fit: true,
                spacing: 0,
                panels: [
                {
                    id: "center-panel",
                    header: false,
                    title: "中间模块",
                    region: "center"
                }, {
                    id: "west-panel",
                    resizable: true,
                    collapsible: true,
                    title: "<span style='color:#15428B;font-weight: bold;padding:6px;'>查询条件</span>",
                    region: "west",
                    width: 230
                },
                {
                    id: "south-panel",
                    region: "south",
                    header: false,
                    resizable: false,
                    collapsible: false,
                    height: 50
                }
                ]
            });
            showSearchPanel();


            //Grid Column 
            colData = [
                { header: '流水号', name: 'OrderNo', width: 80, align: 'left' },
                { header: '业务类型', name: 'OrderType', width: 50, align: 'left' },
                { header: '一级部门', name: 'DeptName1', width: 80, align: 'left' },
                { header: '二级部门', name: 'DeptName2', width: 80, align: 'left' },
                { header: '客户编码', name: 'CustomerCode', width: 120, align: 'left' },
                { header: '客户名称', name: 'CustomerName', width: 80, align: 'left' },
                { header: '业务完成时间', name: 'OrderDate', width: 80, align: 'center', renderer: genRenderDateformatSS },
                { header: '分运单号', name: 'HawbNo', width: 80, align: 'left' },
                { header: '总运单号', name: 'MawbNo', width: 120, align: 'left' },
                { header: '报关单号', name: 'DeclareNo', width: 120, align: 'left' },
                { header: '件数', name: 'Piece', width: 30, align: 'right' },
                { header: 'TEU', name: 'TEU', width: 30, align: 'right' },
                { header: '毛重', name: 'GrossWeight', width: 50, align: 'right' },
                { header: '净重', name: 'ChgWeight', width: 50, align: 'right' },
                { header: '体积', name: 'Volume', width: 50, align: 'right' },
                { header: '外贸部', name: 'SupllyTrade', width: 120, align: 'left' },
                { header: '运输部', name: 'SupllyTrans', width: 120, align: 'left' },
                { header: '换单部', name: 'SupllyExchange', width: 120, align: 'left' },
                { header: '报检部', name: 'SupplyInspection', width: 120, align: 'left' },
                { header: '口岸放行部', name: 'SupplyCustoms', width: 120, align: 'left' },
                { header: '创建人', name: 'UserCreate', width: 100, align: 'center' },
                { header: '创建时间', name: 'CreateDate', width: 120, align: 'center', renderer: genRenderDateformat },
                { header: '修改人', name: 'UserModify', width: 100, align: 'center' },
                { header: '修改时间', name: 'ModifyDate', width: 130, align: 'center', renderer: genRenderDateformat }
            ];
            //排序
            defaultSort = { sortby: 'OrderNo', sortdir: 'ASC' };
            //条件
            defaultWhere = { where: ' 1=1 ' };
            //初始化
            listGrid = $('#listgrid').omGrid({
                width: '100%',
                height: 'fit',
                //autoFit: true,
                //title: '支票列表',
                singleSelect: true,
                limit: 100,
                extraData: $.extend(defaultWhere, defaultSort),
                dataSource: "{rows:[],total:0}",
                colModel: colData
            });
        });

        genRenderCheckbox = function (colValue, rowData, rowIndex) {
            if (colValue) {
                return '<input type="checkbox" id="00" checked="checked" disabled="disabled"></input>';
            }
            return '<input type="checkbox" id="01" disabled="disabled"></input>';
        }

        genRenderDateformatSS = function (colValue, rowData, rowIndex) {
            if (colValue.length == 0 || colValue == null) {
                return '';
            }
            else {
                if (colValue.indexOf("/Date") > -1)
                    return new Date(parseInt(colValue.replace("/Date(", "").replace(")/", ""), 10)).Format("yyyy-MM-dd");
                else
                    return colValue;
            }
        }

        genRenderDateformat = function (colValue, rowData, rowIndex) {
            if (colValue.length == 0 || colValue == null) {
                return '';
            }
            else {
                if (colValue.indexOf("/Date") > -1)
                    return new Date(parseInt(colValue.replace("/Date(", "").replace(")/", ""), 10)).Format("yyyy-MM-dd hh:mm");
                else
                    return colValue;
            }
        }
        //查询语句
        showSearchPanel = function () {
            $("#button-search").click(function () {
                var custWhere = '';
                if ($("#search-panel input[id='CreateDateFM']").datebox("getValue").length > 0) {
                    custWhere = " AND (CreateDate BETWEEN '" + $("#search-panel input[id='CreateDateFM']").datebox("getValue") + "' AND ";
                    if ($("#search-panel input[id='CreateDateTO']").datebox("getValue").length > 0) {
                        custWhere += " DATEADD(DAY,1,'" + $("#search-panel input[id='CreateDateTO']").datebox("getValue") + "')) "
                    }
                    else {
                        custWhere += " DATEADD(DAY,1,GETDATE())) "
                    }
                }
                if ($("#search-panel input[id='OrderNo']").val().length > 0) {
                    custWhere += ' AND OrderNo LIKE ' + '\'%' + $("#search-panel input[id='OrderNo']").val() + '%\'';
                }
                if ($("#search-panel input[id='CustomerName']").val().length > 0) {
                    custWhere += ' AND CustomerName LIKE ' + '\'%' + $("#search-panel input[id='CustomerName']").val() + '%\'';
                }
                listGrid.omGrid({
                    extraData: $.extend({ where: defaultWhere.where + custWhere }, defaultSort),
                    dataSource: '../Handler/grid.ashx?view=vOrder'
                });
            });
            $('#button-clear').click(function () {
                $("div[id='search-panel'] input").val("");
            });
        };
    </script>
</head>
<body>
    <div id="west-panel" class="westpanel">
        <div id="search-panel">
            <table>
                <tr>
                    <td style="width: 80px" align="right">
                        <span class="label">创建时间</span>
                    </td>
                    <td>
                        <input type="text" class="easyui-datebox" id="CreateDateFM" " name="CreateDateFM" style="width: 120px;" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px" align="right">
                        <span class="label">到</span>
                    </td>
                    <td>
                        <input type="text" class="easyui-datebox" id="CreateDateTO" " name="CreateDateTO" style="width: 120px;" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px" align="right">
                        <span class="label">业务流水</span>
                    </td>
                    <td>
                        <input type="text" class="input-text" name="OrderNo" id="OrderNo" 
                            data-options="required:false;" style="border: 1px solid #A4BED4; height:20px;width: 120px;" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px" align="right">
                        <span class="label">客户简称</span>
                    </td>
                    <td>
                        <input type="text" class="input-text" name="CustomerName" id="CustomerName" 
                            data-options="required:false;" style="border: 1px solid #A4BED4; height:20px;width: 120px;" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="center-panel">
        <table id="listgrid"></table>
    </div>
    <div id="south-panel">
        <table style="margin-top: 5px; margin-left: 20px;">
            <tr>
                <td>
                    <input id="button-search" type="button" class="btnCss" value="搜    索" />
                    <input id="button-clear" type="button" class="btnCss" value="清    空" style="margin-left: 20px;" />
                </td>
            </tr>
        </table>
    </div>
</body>
</html>
